<template>
    <div>
        <div class="mui-numbox" data-numbox-min='0'>
            <button class="mui-btn mui-numbox-btn-minus" type="button">-</button>
            <input class="mui-numbox-input" type="number" value="1" ref="numbox" @change="countChanged"/>
            <button class="mui-btn mui-numbox-btn-plus" type="button">+</button>
        </div>      
    </div>
</template>

<script>
import mui from '../../lib/mui/js/mui.js'
export default {
    mounted() {
        mui('.mui-numbox').numbox()
    },
    methods: {
        countChanged(){
            this.$emit('getCount',mui('.mui-numbox').numbox().getValue())
        }
    },
    props:['max'],
    watch: {
        'max':function(newval){
            mui('.mui-numbox').numbox().setOption('max',newval)
        }
    },
}
</script>

<style lang="scss" scoped>
    
</style>